Configure PostgreSQL databases
This guide describes how to configure PostgreSQL databases.
PostgreSQL folders
The following information will help you use the PostgreSQL database with StarTeam Server:
- It is installed in the pgsql folder under the StarTeam Server folder.
- The service name is StarTeam-PostgreSQL.
- The superuser login name is postgres.
- The following StarTeam Server functionality is not available for PostgreSQL: Online Purge, Maintenance Scheduler, and the Import/Export Manager.
When connecting to a PostgreSQL database server on Microsoft Windows, the Microsoft Windows path should include the path to the PostgreSQL bin directory. If the path to the PostgreSQL libraries is not set correctly, a message similar to the following one will appear:
Libpq.dll: The specified module could not be found. pq.dll: The specified module could not be found. DBMS API Library loading fails. This library is a part of DBMS client installation, not SQLAPI++. Make sure DBMS client is installed and this required library is available for dynamic loading.
When connecting to a PostgreSQL database server on Microsoft Windows, the Microsoft Windows system path should include the path to the PostgreSQL bin directory. For example, for a default installation, add this to the System PATH variable: C:\Program Files\PostgreSQL\9.3\bin.
Note: When a new database is created, all the default PostgreSQL settings (for example, file location and size) are used except for server encoding. This setting must be UTF-8.
Backups
We recommend using the pg_dump utility for backing up a PostgreSQL database. It makes consistent backups even if the database is being used concurrently. pg_dump does not block other users accessing the database (readers or writers). The most flexible output file formats is the directory format (-Fd). This format is compressed by default.
Upgrade to PostgresQL 13 from PostgreSQL 9
Starteam Server 17.3 will optionally install PostgreSQL 13 on port 5433, and is backwards compatible with PostgreSQL 9.x.
To upgrade a configuration from PostgreSQL 9.x to 13:
- Create a backup in the following directory: Maintenance>Database backups>PostgreSQL Backups
- Install the StarTeam Server 17.3, make sure to select PostgreSQL installation under Custom.
-
Restore the backup of StarTeam PostgreSQL 9.x database to PostgreSQL 13.x, as described in the following steps:
- Install PGadmin 4.
- Connect to Postgresql 13 using port 5433.
- Create a database user with the same name and password as the one used for the StarTeam PostgreSQL 9.x database. Make sure you give the user the "can login" and "Inherit right from the parent roles" privileges.
- Create the database with the same name as the one used in the StarTeam PostgreSQL 9.x database.
- Set the owner of the database to the user you created in step c.
-
Use the pg_restore command to restore the database backup to the new PostgreSQL 13 database and set the port to 5433:
Copy codepg_restore -U postgres -h < Hostname> -p 5433 -d <Db Name> StarTeam.backup
-
Upgrade the StarTeam Repository and database.
-
Point the Server configuration to the new PostgreSQL 13 instance by changing the port:
Open the starteam-server-configs.xml file in the StarTeam Server installation directory, and then change or edit the dbport to
5433
:<option name="DBPort" value="5433"/>
- Shutdown the PostgreSQL 9 Windows service with the name pgsql.
- Open the Server Administration and select your configuration, make sure database port in the Server/Configuration Properties/Database Connection Information is set to 5433 and then click Verify Connection.
-
Run database upgrade if required, and then start the server.
Tip: You can use the StarTeam Migration.
-
-
If Pulse Code review was configured before the upgrade, do the following:
- Backup the Pulse database from the existing PostgreSQL 9 database and then restore it into the PostgreSQL 13 database.
- Create a corresponding new Pulse user on the PostgreSQL 13 database.
- Modify the database.jdbcurl property to connect to the database port 5433 in the <StarTeam Server install>/Pulse/startup.properties directory.
Install PostgreSQL 13 on Linux RedHat 8
Go to the following site to download and install PostgreSQL 13: https://www.postgresql.org/download/linux/redhat/
It is recommend that you install the pgadmin 4. You can download the pgadmin 4 at: https://www.tecmint.com/install-postgresql-and-pgadmin-in-rhel-8/
For instructions on how to install PostgreSQL 13, see https://www.postgresql.org/. When the installation asks for the location of PostgreSQL directory, use the following: /usr/pgsql-13.
Create a server configuration (for an existing database)
The first time you start a new server configuration, StarTeam Server creates all tables in the database you specify. This section explains how to create a StarTeam Server configuration using a previously created PostgreSQL database. Database names should:
- Begin with a letter.
- Contain letters and numbers only.
- Not contain spaces.
- Not be a SQL reserved word such as create, delete, if, then, else, or goto.
Note: The Server Administration database options may fail to run for databases with names that do not follow these guidelines.
- Start the Server Administration tool. Click . The Server Administration tool opens.
- Click . The New Configuration dialog box opens.
-
Enter the new configuration data:
- Type the name of the configuration in the Configuration Name field. If you want the server configuration to have the same name as the database (a nice convention, especially if you have several server configurations), you must follow the database naming conventions explained at the beginning of this section.
- Type or click Browse to specify the Repository Path location to be used to store log files and other information. If the repository path that you enter does not exist, the application creates it for you. The Repository Path is also the location for the default hive.
- Select PostgreSQL from the Database Type list.
- Uncheck the option to Create new StarTeam database, so that StarTeam Server will not automatically create the database for it.
-
Create an initial hive for the Native-II vault by doing one of the following:
Accept the default settings Leave the Default option selected and proceed to the next step. With the default settings, StarTeam Server:
- Creates an initial hive named DefaultHive.
- Creates subfolders on the repository path named Archives and Cache to be used by the DefaultHive.
- Stipulates that the maximum cache size is 20% of the space currently available on the drive on which the cache is located.
- Uses the default setting of 600 seconds (10 minutes) between cache cleanups.
- Uses the default setting of 95% for the storage threshold, the point at which this drive is considered full.
Specify custom values Select the Custom option and change any of the hive settings. - Click Next, and enter the Database Server name, Database name, Database login name, and password in the appropriate text boxes.
- Optionally, if you are using a port other than the default, check Edit Database Port and type the port number in the text field.
- Click Verify Connection to test the connection. If the connection fails, review and change your settings.
-
Click
Finish.
This action re-displays the
Server Administration tool, which shows your new server configuration as a child of the
Local node.
Note: In addition to creating the server configuration, StarTeam Server adds information about the new server configuration to your starteam-server-configs.xml file. For more information about this file, see the Server Administration Tool Help.
- Optionally, if you are using a port other than the default, check Edit Database Port and type the port number in the text field.
- Click Verify Connection to test the connection. If the connection fails, review and change your settings.
-
Click
Finish.
This action re-displays the
Server Administration tool, which shows your new server configuration as a child of the
Local node.
Note: In addition to creating the server configuration, StarTeam Server adds information about the new server configuration to your starteam-server-configs.xml file. For more information about this file, see the Server Administration Tool Help.
-
By default, all server configurations are set to use the TCP/IP endpoint (port) 49201. However, each server configuration on a given computer must have a unique endpoint so it is recommended that you edit the default endpoint. To change the endpoint:
- Select the server configuration.
- Click the Start with Override button (or click from the main menu). The Start with Override dialog box opens.
- Enter the endpoint that you want to use in the TCP/IP Endpoint field, and click OK.
- Be sure to configure your new server configuration (for information, see the Server Administration Tool Help) and plan a backup schedule for it.
Create and start a server configuration (new database)
The first time you start a new server configuration, StarTeam Server creates all tables in the database you specify. This section explains how to create a server configuration and start it for the first time. It assumes that you want the server to automatically create a PostgreSQL database. If that is not the case, see Create a database manually. Database names should:
- Begin with a letter.
- Contain letters and numbers only.
- Not contain spaces.
- Not be a SQL reserved word such as create, delete, if, then, else, or goto.
Note: The Server Administration database options may fail to run for databases with names that do not follow these guidelines.
- Start the Server Administration tool. Click . The Server Administration tool opens.
- Click . The New Configuration dialog box opens.
-
Enter the new configuration data:
- Type the name of the configuration in the Configuration Name field. If you want the server configuration to have the same name as the database (a nice convention, especially if you have several server configurations), you must follow the database naming conventions explained at the beginning of this section.
- Type or click Browse to specify the Repository Path location to be used to store log files and other information. If the repository path that you enter does not exist, the application creates it for you. The Repository Path is also the location for the default hive.
- Select PostgreSQL from the Database Type list.
- Check the option to Create new StarTeam database, so that StarTeam Server automatically creates the database.
-
Create an initial hive for the Native-II vault by doing one of the following:
Accept the default settings Leave the Default option selected and proceed to the next step. With the default settings, StarTeam Server:
- Creates an initial hive named DefaultHive.
- Creates subfolders on the repository path named Archives and Cache to be used by the DefaultHive.
- Stipulates that the maximum cache size is 20% of the space currently available on the drive on which the cache is located.
- Uses the default setting of 600 seconds (10 minutes) between cache cleanups.
- Uses the default setting of 95% for the storage threshold, the point at which this drive is considered full.
Specify custom values Select the Custom option and change any of the hive settings. - Click Next to create the PostgreSQL database.
-
Enter the server and database information:
- Enter the name in the Database Server name field.
- Type or click Browse to specify the names of the computer and the database on your network that should be used.
- Enter the password for the system administrator in the Database Server name field. The initial default system administrator password is postgres.
- Click Verify Connection to test the connection. If the connection fails, review and change your settings.
- Click Next.
-
Enter the information for creating the data files and transaction logs, and click
Finish.
Note: We recommend keeping the data files and transaction log files on different physical drives under their own disk controllers.
The default settings are appropriate for your use if you have fewer than 15 users and expect to store 1GB or less data.
-
By default, all server configurations are set to use the TCP/IP endpoint (port) 49201. However, each server configuration on a given computer must have a unique endpoint so it is recommended that you edit the default endpoint. To change the endpoint:
- Select the server configuration.
- Click the Start with Override button (or click from the main menu). The Start with Override dialog box opens.
- Enter the endpoint that you want to use in the TCP/IP Endpoint field, and click OK.
- Be sure to configure your new server configuration (for information, see the Server Administration Tool Help) and plan a backup schedule for it.
SQL scripts for PostgreSQL databases
StarTeam Server comes with some SQL scripts written specifically for use with your database. These scripts help you maintain and tune StarTeam Server databases. You run some SQL scripts after installation, some on a weekly basis for database performance maintenance, and some scripts are run for you automatically by StarTeam Server.
The SQL scripts for PostgreSQL databases that you may run are located in the Micro Focus\StarTeam Server <version>\DBScripts\postgresql_Scripts folder.
starteam_postgresql_dropall.sql
Run: only if necessary.
One use case example is if you migrate a StarTeam Server configuration to another database, you might use this script to remove tables from the original database. Another example is if you mistakenly add the StarTeam Server tables to a tablespace other than the StarTeam Server tablespace, use this script to remove them.
Create a database manually
Despite the fact that StarTeam Server has automated PostgreSQL database creation, you may prefer to create your own. This makes more sense for PostgreSQL because there are good tools for database creation. Database names should:
- Begin with a letter.
- Contain letters and numbers only.
- Not contain spaces.
- Not be a SQL reserved word such as create, delete, if, then, else, or goto.
To create your own PostgreSQL server database:
- Install PostgreSQL Server.
- Install StarTeam Server. See StarTeam Server on Windows installation .
-
Create a StarTeam Server database. Contact your database administrator about the specifics. Be sure that:
- The database is owned by a StarTeam Server user.
- The name of the database follows the conventions explained earlier in this section.
- The template for the database is template0.
- The encoding for the database should be: UTF-8. This refers to the physical storage of character strings in the database.
- Create and start a server configuration. For details, see Create a server configuration (for an existing database).